Allow tsc to be run within a node v8 snapshot#55830
Allow tsc to be run within a node v8 snapshot#55830jakebailey wants to merge 18 commits intomicrosoft:mainfrom
Conversation
|
I made an alternative entrypoint which is able to create a snapshot on the fly and use it for further executions. Even in the best case where I don't check that the file hasn't change, it doesn't really save all that much: Hard to say whether or not this is worth it when we're not shipping the blobs themselves (which, we can't). |
|
@typescript-bot perf test |
|
Heya @jakebailey, I've started to run the regular perf test suite on this PR at 75c9404. You can monitor the build here. Update: The results are in! |
|
@typescript-bot perf test |
|
Heya @jakebailey, I've started to run the regular perf test suite on this PR at e43ced9. You can monitor the build here. Update: The results are in! |
|
@jakebailey, the perf run you requested failed. You can check the log here. |
|
@jakebailey Here they are:
startupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
So far: The perf benchmarker does not do warmup runs, so it's a little unhappy. It fares worse than my machine at only a 30% startup boost. |
|
For those following this, native automatic caching in Node is able to achieve better perf than what I was able to do: nodejs/node#47472 (comment) $ hyperfine -w 10 -r 100 'NODE_COMPILER_CACHE= $HOME/work/node/out/Release/node ./built/local/tsc.js --version' 'NODE_COMPILER_CACHE=./tmp $HOME/work/node/out/Release/node ./built/local/tsc.js --version'
Benchmark 1: NODE_COMPILER_CACHE= $HOME/work/node/out/Release/node ./built/local/tsc.js --version
Time (mean ± σ): 89.9 ms ± 1.4 ms [User: 77.9 ms, System: 11.1 ms]
Range (min … max): 88.0 ms … 97.7 ms 100 runs
Benchmark 2: NODE_COMPILER_CACHE=./tmp $HOME/work/node/out/Release/node ./built/local/tsc.js --version
Time (mean ± σ): 39.9 ms ± 0.6 ms [User: 29.9 ms, System: 9.6 ms]
Range (min … max): 38.7 ms … 42.6 ms 100 runs
Summary
'NODE_COMPILER_CACHE=./tmp $HOME/work/node/out/Release/node ./built/local/tsc.js --version' ran
2.25 ± 0.05 times faster than 'NODE_COMPILER_CACHE= $HOME/work/node/out/Release/node ./built/local/tsc.js --version' |
|
@typescript-bot perf test |
|
@jakebailey Here they are:
tscComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
startupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
Per #55830 (comment), I'm going to close this. I think the future of caching is going to be via Node directly. |
This PR switches
tsc.jsto a wrapper which:tsc.jsand the Node version to choose a path a snapshot.Startup speed of the wrapper (as of Feb 13, 2024):
If we just run the blob directly without the wrapper, the speedup would be a lot more:
But there's no easy way to have Node do this.
Related: #25658